package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.Category;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by oyhk on 14-6-22.
 */
@Repository
public interface CategoryRepository extends JpaRepository<Category, Long>, JpaSpecificationExecutor, CategoryRepositoryCustom {

    Category findByIdAndMallId(Long id, Long mallId);

    List<Category> findByMallIdAndVisibleAndIsDeleteAndParentIdIsNull(Long mallId, Boolean visible, Whether isDelete);

    List<Category> findByMallIdAndVisibleAndIsDeleteAndParentIdIn(Long mallId, boolean visible, Whether isDelete, List<Long> parentId);

    Category findByIdAndVisible(Long categoryId, Boolean visible);

    Category findById(Long id);
}
